/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
    
package be.vdabantwerpen.gow.dao;
    
import be.vdabantwerpen.gow.entities.GOWUser;
import be.vdabantwerpen.gow.entities.Post;
import be.vdabantwerpen.gow.entities.Score;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.repackaged.org.joda.time.DateTime;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Tim.VandenLangenberg
 * @version 12/06/2013
 */
public class ScoreDAOTemp implements ScoreDAO {
    private final List<Score> scores = new ArrayList();
    
    {
        //TODO: Vul scores
    }
    
    @Override
    public void create(Score score){
        scores.add(score);
    }
    
    @Override
    public Score read(int scoreId){
        for(int i = 0; i < scores.size(); i++){
            Score score = scores.get(i);
            //TODO: Identify score
        }
        return null;
    }
    
    @Override
    public void update(Score score){
        int index = scores.indexOf(score);
        scores.remove(index);
        scores.add(index, score);
    }
    
    @Override
    public void delete(Score score){
        scores.remove(score);
    }
    
    @Override
    public List<Score> findScoresByUser(GOWUser user){
        List<Score> output = new ArrayList();
        for(Score score : scores){
            if(score.getUser().equals(user)){
                output.add(score);
            }
        }
        return output;
    }
    
    @Override
    public List<Score> findScoresbyPost(Post post){
        List<Score> output = new ArrayList();
        for(Score score : scores){
            if(score.getPost().equals(post)){
                output.add(score);
            }
        }
        return output;
    }
    
}
